package com.bootdo.clouddo.dao.user;

import com.bootdo.clouddo.domain.user.QaUsers;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.BaseMapper;

@Mapper
public interface QaUsersMapper extends BaseMapper<QaUsers> {
  
	/**
	 * @Title
	 * @Description
	 * @param userName
	 * @return
	 * return type:QaUsers
	 */
	QaUsers selectByUserName(String userName);
	
	/**
	 * @Title
	 * @Description
	 * @param name
	 * @return
	 * return type:QaUsers
	 */
	QaUsers selectByUserNameOrMobile(String name);

	/**
	 * @Title
	 * @Description
	 * @param email
	 * @return
	 * return type:QaUsers
	 */
	QaUsers selectByEmailName(String email);

	/**
	 * 根据用户ID修改用户信息
	 * param id
	 * author zhengjia
	 */
	Integer updateUserInfoById(QaUsers qaUsers);

	int updateUserMobileById(QaUsers qaUsers);

	QaUsers selectByMobile(String mobile);

	boolean existsByMobile(@Param("mobile") String mobile);
	
	Integer updatePwdByMobile(QaUsers qaUsers);

	/**
	 * 根据ID修改密码
	 * @param qaUsers
	 * @return
	 */
	Integer modifyPasswordById(QaUsers qaUsers);

	int updateAvatar(@Param("uid") Long uid, @Param("url") String url);
	
	int fieldIncrease(@Param("field") String field, @Param("val") Integer val, @Param("uid") Long uid);
	
	QaUsers selectByWxOpenId(String openId);

	int updateVip(@Param("uid") Long uid);

	int updateIntegralExp(@Param("obtainIntegral") Double obtainIntegral, @Param("obtainExp") Double obtainExp, @Param("uid") Long uid);

	Long countTotal();

	Integer findExpRank(@Param("uid") Long uid);

	Integer findIntegralRank(@Param("uid") Long uid);

	Double findNewIntegral(@Param("uid") Long uid);

	Double findNewExp(@Param("uid") Long uid);

	int updateSignInDays(@Param("uid") Long uid, @Param("days") Integer days);

	int findRankForSignInDays(@Param("uid") Long uid);

	int updateSignInDaysRank(@Param("uid") Long uid, @Param("rank") Integer rank);

	boolean existsByVipMobile(@Param("mobile") String mobile);

}